package no.ntnu.fp.model;

import java.util.ArrayList;

public class WellPoller extends Thread {
	private ArrayList<Well> wells;
	private boolean isPolling;
	
	public WellPoller() {
		wells = new ArrayList<Well>();
		isPolling = false;
	}

	public ArrayList<Well> getWells() {
		return wells;
	}

	public void setWells(ArrayList<Well> wells) {
		this.wells = wells;
	}
	
	public void run() {
		isPolling = true;
		if (isPolling) {
			
			for (Well well : wells) {
				well.poll();
			}
			try {
				Thread.sleep(1000); 
			}
			catch (InterruptedException e) {
				System.out.println("WHY ARE YOU INTERRUPTING MY SLEEP, ASS!");
			}
		}
	}
	
	public void startPolling() {
		isPolling = true;
	}
	
	public void stopPolling() {
		isPolling = false;
	}
	
	

}
